<?php if(isset($_SESSION['user']['user_id']) && $_SESSION['user']['user_id']!=""){?>
<div class="col-md-8">
<div class="main-content" id="main-content">
	<div class="sub-content">
		<div class="top-header page-header clearfix">
			<h1>Confirm Status</h1>
		</div>
		<div class="middle-forms col-md-11">
			<form id="forms" method="post" class="form-horizontal" role="form">
			
				<? if(isset($_SESSION['user']['user_type']) && $_SESSION['user']['user_type']!='user') {?>
					<div class="form-group">
						<label class="control-label col-sm-3">User Name</label>
						<div class="col-sm-9">
						<? if(isset($this->user_details->company_name) && $this->user_details->company_name!=""){?>
							<input type="text" readonly="readonly" class="form-control" value="<?php echo $this->user_details->company_name;?>" id="generic" name="generic" placeholder="eg Styrene Acrylic Emulsion" />
						<?}?></div>
					</div>
				<?}?>
					
					<div class="form-group">
						<label class="control-label col-sm-3">Generic Name</label>
						<div class="col-sm-9">
						<? if(isset($this->buyDetails->genericname) && $this->buyDetails->genericname!=""){?>
							<input type="text" readonly="readonly" class="form-control" value="<?php echo $this->buyDetails->genericname;?>" id="generic" name="generic" placeholder="eg Styrene Acrylic Emulsion" />
						<?}?></div>
					</div><span style="color:red" id="errorgname"></span>					
					<div class="form-group">
						<label class="control-label col-sm-3">Quantity Bought</label>
						<div class="col-sm-9">
						<?  if(isset($this->buyDetails->order_for_quantity) && $this->buyDetails->order_for_quantity!=""){?>
							<input type="text"  readonly="readonly" class="form-control" value="<?php  echo $this->buyDetails->order_for_quantity;?>" id="fuction" name="fuction" placeholder="eg Binder, Defoamer, Biocide" />
						<?}?></div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-3">Bought Price</label>	<div class="col-sm-9">
							<?  if(isset($this->buyDetails->order_for_price) && $this->buyDetails->order_for_price!=""){?>
								<input readonly="readonly" type="text" class="form-control" value="<? echo $this->buyDetails->order_for_price;?>" id="origin_name" name="origin_name" placeholder="eg origin" />
							<?}?></div>
					</div>
					<?
					if(isset($this->status) && $this->status!=""){
						if($this->status==0){
							$confirnm='Pending';
						}else if($this->status==1){
							$confirnm='Processing';
						}else if($this->status==2){
							$confirnm='Processed';
						}else if($this->status==3){
							$confirnm='Canceld';
						}	
					}
					?>
					<div class="form-group">
						<label class="control-label col-sm-3">Status</label>	
						<div class="col-sm-9">
						<input readonly="readonly" type="text" class="form-control" value="<? echo $confirnm;?>" id="status" name="status" placeholder="eg origin" />							
						<input type="hidden" id="newStatus" name="newStatus" value="<? if(isset($this->status) && $this->status!=""){ echo $this->status;}?>">
					</div></div>
					<input type="hidden" id="id" name="id" value="<? if(isset($this->buyDetails->buy_id) && $this->buyDetails->buy_id!=""){ echo $this->buyDetails->buy_id;}?>">
					<input type="hidden" id="type" name="type" value="<? if(isset($this->buyDetails->type) && $this->buyDetails->type!=""){ echo $this->buyDetails->type;}?>">
					<input type="hidden" id="buyer_id" name="buyer_id" value="<? if(isset($this->user_details->user_id) && $this->user_details->user_id!=""){ echo $this->user_details->user_id;}?>">
					<input type="hidden" id="product_owner_id" name="product_owner_id" value="<? if(isset($this->buyDetails->business_user_id) && $this->buyDetails->business_user_id!=""){ echo $this->buyDetails->business_user_id;}?>">
					<input type="hidden" id="hid_product_id" name="hid_product_id" value="<? if(isset($this->buyDetails->product_id) && $this->buyDetails->product_id!=""){ echo $this->buyDetails->product_id;}?>">
					<div class="form-group">
						<label class="control-label col-sm-3">Updating Status</label>	<div class="col-sm-9">
						<textarea id="note" name="note" class="form-control"></textarea></div>
					</div>
					<div class="form-group">
						
							<div class="col-sm-3">&nbsp;</div>
						<div class="col-sm-9">							
								<a href="javascript:void(0)" class="btn btn-danger" role="button" onclick="return statusUpdate()" value="submit">Update Status</a>
								<div id="loading" style="display:none;float:right;margin-right:30px;"><img src="<?php echo $this->basePath() ?>/images/loading_image.gif" /></div>
							</div>
						
					</div>
			</form>
		</div>
	 </div>
</div> </div>
<script>
	function statusUpdate(){
		$("#loading").show();
		var flag=true;
		if($("#note").val()==""){
			alert("Please enter meaasge");
			flag=false;
		}
		if(flag==false){
			$("#loading").hide();
			return false;
		}else{
			$("#forms").submit();
		}
	}
</script>
<?php }else{?>
<script>
	window.location='<? echo $this->Url('home')?>';
</script>
<?php }?>